home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 52
/
Volume 52 - JOGO DISK .iso
/
Games
/
puppyred_ball_war.swf
/
scripts
/
frame_19
/
DoAction.as
Wrap
Text File
|
2007-09-26
|
5KB
|
190 lines
function powerup()
{
powerH = 41;
_root[playname].energy.onEnterFrame = function()
{
powerH = 41;
if(poweron == 1)
{
this.p += 2;
energyH = this.p;
if(this.p % 3 == 2)
{
this.z = this.z + 1;
this["e" + this.z]._visible = 1;
}
if(this.p >= powerH)
{
this.p = powerH;
}
}
};
}
function encreat()
{
if(level < 5)
{
enemypoz.attachMovie("level" + level,"level" + level,10);
}
else
{
enemypoz.attachMovie("level4","level4",10);
}
}
stop();
dieNum = 0;
over._visible = 0;
alldie = 0;
endieNum = 0;
x = 13;
y = 9;
_root.createEmptyMovieClip("enthrowpoz",10000);
_root.createEmptyMovieClip("throwpoz",1000);
var i = 1;
while(i <= 4)
{
_root["player" + i].onPress = function()
{
if(!this.hit & !this.die)
{
this.move = 1;
this.gotoAndStop("ready");
playname = this._name;
_root[playname].attachMovie("energy","energy",10);
poweron = 1;
powerup();
}
};
_root["player" + i].onMouseMove = function()
{
if(!this.hit & !this.die)
{
if(this.move == 1)
{
this._x = _xmouse;
this._y = _ymouse;
if(this._x > 600)
{
this._x = 600;
}
if(this._x <= 0)
{
this._x = 0;
}
if(this._y >= 350)
{
this._y = 350;
}
}
}
};
_root["player" + i].onMouseUp = function()
{
if(!this.hit & !this.die)
{
if(this.move == 1)
{
this.move = 0;
this.gotoAndStop("throw");
poweron = 0;
_root[playname].energy.removeMovieClip();
s++;
if(s > 5)
{
s = 1;
}
if(this == player1)
{
throwNum = 1;
}
if(this == player2)
{
throwNum = 2;
}
if(this == player3)
{
throwNum = 3;
}
if(this == player4)
{
throwNum = 4;
}
throwpoz.attachMovie("throw" + throwNum,"throw" + s,s);
throwpoz["throw" + s]._x = this._x - 20;
throwpoz["throw" + s]._y = this._y - 10;
if(!this.hitTest(_xmouse,_ymouse,true))
{
this.gotoAndStop(1);
}
}
}
};
_root["player" + i].onRollOver = function()
{
if(!this.hit & !this.die)
{
this.gotoAndStop("over");
}
};
_root["player" + i].onRollOut = function()
{
if(!this.hit & !this.die)
{
this.move = 0;
_root[playname].energy.removeMovieClip();
poweron = 0;
this.gotoAndStop(1);
}
};
_root["player" + i].onEnterFrame = function()
{
if(_root[playname]._y <= - 0.5833333333333334 * _root[playname]._x + 370)
{
_root[playname]._y = - 0.5833333333333334 * _root[playname]._x + 370;
if(_root[playname]._y >= 350)
{
_root[playname]._y = 350;
}
}
var r = 1;
while(r <= 30)
{
if(this.hitTest(_root.enthrowpoz["enthrow" + r]._x,_root.enthrowpoz["enthrow" + r]._y,true) & !this.die)
{
this.move = 0;
this.hitNum = this.hitNum + 1;
_root.enthrowpoz["enthrow" + r].removeMovieClip();
this.energy.removeMovieClip();
if(this.hitNum == 1)
{
this.gotoAndStop("hit");
this.hit = true;
}
if(this.hitNum >= 2)
{
this.gotoAndStop("die");
this.die = true;
_root.dieNum = _root.dieNum + 1;
if(_root.dieNum >= 4)
{
_root.alldie = 1;
over._visible = 1;
if(_root.score >= 100)
{
over.gotoAndStop(2);
}
else
{
over.gotoAndStop(3);
}
over.swapDepths(40000);
}
}
}
r++;
}
};
i++;
}
encreat();